// 设备屏幕信息
const SYSTEM_INFO = uni.getSystemInfoSync();
const getStatusBarHeight = () => SYSTEM_INFO.statusBarHeight ?? 0;
// 微信小程序胶囊信息
const getTitleBarHeight = () => {
	if(uni.getMenuButtonBoundingClientRect) {
		const { top, height } = uni.getMenuButtonBoundingClientRect();
		return (height + (top - getStatusBarHeight()) * 2) ?? 0;	
	} else {
		return 40;
	}
}
const getNavBarHeight = () => getStatusBarHeight() + getTitleBarHeight();
// 抖音小程序
const getLeftIconWidth = () => {
	// #ifdef MP-TOUTIAO
	if(tt.getCustomButtonBoundingClientRect) {
		let { leftIcon: { left, width } } = tt.getCustomButtonBoundingClientRect();
		return left + parseInt(width) + 5
	}
	// #endif
	return 0;
}

export {
	getStatusBarHeight,
	getTitleBarHeight,
	getNavBarHeight,
	getLeftIconWidth
}